package com.mtk.launcher.test;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.mtk.launcher.databinding.ActivityFunctionTestBinding;
import com.mtk.launcher.util.ScreenWakeUtil;

public class FunctionTestActivity extends AppCompatActivity {

    private ActivityFunctionTestBinding binding;
    private Handler handler = new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityFunctionTestBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        ScreenWakeUtil screenWakeUtil = new ScreenWakeUtil(this);

        // 设置按钮点击事件
        binding.btnSleep.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.e("cdlLog", "==点击了休眠");
                screenWakeUtil.gotoSleep();
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        boolean success = screenWakeUtil.wakeUpScreen();
                        Log.e("cdlLog", "==点击了唤醒==" + success);
                    }
                }, 5000);

            }
        });
        binding.btnPowerOnOff.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
//                Intent intentSdCheck = new Intent(FunctionTestActivity.this, PowerControlActivity.class);
//                intentSdCheck.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//                startActivity(intentSdCheck);
            }
        });
    }


}